package org.wotou.authority.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.wotou.authority.dao.HtlogDAO;
import org.wotou.authority.domain.wtlogDO;
import org.wotou.authority.utils.PageJpa;
import org.wotou.authority.utils.PageUtil;

import java.util.Map;

/**
 * 日志service
 *
 * @author zhangQ
 * @date 2017/12/7
 */
@Service
public class HtlogService {
    @Autowired
    private HtlogDAO htlogDAO;

    public wtlogDO saveHtlog(wtlogDO htlog) {
        return htlogDAO.save(htlog);
    }

    public PageJpa<wtlogDO> getList(PageJpa<Map<String, String>> pageJpa) {
        Pageable pageable = PageUtil.getPageable(pageJpa);
        return PageUtil.getData(htlogDAO.findAllByOrgId(pageable));
    }
}
